#pragma once
#include "Pascal.h"

	template <typename T>
	class TPointerComparator
	{
	public:
		static Boolean IsLess (const T A, const T B);
		static Boolean IsGreater (const T A, const T B);
		static Boolean IsEqual (const T A, const T B);
	};

	template <typename T>
	class TMemoryComparator
	{
	public:
		static Boolean IsLess (const Pointer A, const Pointer B);
		static Boolean IsGreater (const Pointer A, const Pointer B);
		static Boolean IsEqual (const Pointer A, const Pointer B);
	};

	template <typename T>
	class TValueComparator
	{
	public:
		static Boolean IsLess (const T A, const T B);
		static Boolean IsGreater (const T A, const T B);
		static Boolean IsEqual (const T A, const T B);
	};

	template <typename T, typename TComparator>
	struct TComparable
	{
	public:
		Boolean IsLess (Pointer A, Pointer B) const
		{
			if (typeid(TComparator) == typeid(TValueComparator<T>)) return TValueComparator<T>::IsLess((T)A,(T)B);
			if (typeid(TComparator) == typeid(TMemoryComparator<T>)) return TMemoryComparator<T>::IsLess(A,B);
			if (typeid(TComparator) == typeid(TPointerComparator<T>)) return TPointerComparator<T>::IsLess((T)A,(T)B);
			return FALSE;
		};
		Boolean IsGreater (Pointer A, Pointer B) const
		{
			if (typeid(TComparator) == typeid(TValueComparator<T>)) return TValueComparator<T>::IsGreater((T)A,(T)B);
			if (typeid(TComparator) == typeid(TMemoryComparator<T>)) return TMemoryComparator<T>::IsGreater(A,B);
			if (typeid(TComparator) == typeid(TPointerComparator<T>)) return TPointerComparator<T>::IsGreater((T)A,(T)B);
			return FALSE;
		};
		Boolean IsEqual (Pointer A, Pointer B) const
		{
			if (typeid(TComparator) == typeid(TValueComparator<T>)) return TValueComparator<T>::IsEqual((T)A,(T)B);
			if (typeid(TComparator) == typeid(TMemoryComparator<T>)) return TMemoryComparator<T>::IsEqual(A,B);
			if (typeid(TComparator) == typeid(TPointerComparator<T>)) return TPointerComparator<T>::IsEqual((T)A,(T)B);
			return FALSE;
		};
	public:
		T Value;
	public:
		Boolean operator < (const TComparable B);
		Boolean operator > (const TComparable B);
		Boolean operator == (const TComparable B);
		T operator = (const TComparable A);
		TComparable<T,TComparator> operator = (const T A);
	};